#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    bool checkOnesSegment(string s) {
        int status = 0;
        for(int i =0;i<s.size();++i){
            if((status==0)&&(s[i]=='1')){

            }
            else if((status==0)&&(s[i]=='0')){
                status=1;
            }
            else if((status==1)&&(s[i]=='1')){
                return false;
            }
        }
        return true;
    }
};

int main(){
    Solution S;
    cout<<S.checkOnesSegment("1001")<<endl;
}